package cn.hackcloud.designpattern.iterator;

import java.util.Iterator;
import java.util.List;

public class InfomationIterator implements Iterator {
	List<Department> departments;
	int index = -1;

	public InfomationIterator(List<Department> departments) {
		super();
		this.departments = departments;
	}

	@Override
	public boolean hasNext() {
		if (index >= departments.size() - 1) {
			return false;
		}
		index += 1;
		return true;
	}

	@Override
	public Object next() {
		Department department = departments.get(index);
		return department;
	}

}
